home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr42 / smixw111.zip / LOWMEM.C < prev    next >
C/C++ Source or Header  |  1995-02-24  |  1KB  |  47 lines

  1. /*      SMIXW is Copyright 1995 by Ethan Brodsky.  All rights reserved      */
  2.  
  3. /* ██ lowmem.c ████████████████████████████████████████████████████████████ */
  4.  
  5. /* ════════════════════════════════════════════════════════════════════════ */
  6.  
  7. void dos_memalloc(short int para, short int *seg, short int *sel);
  8. #pragma  aux dos_memalloc = \
  9.   "push  ecx"               \
  10.   "push  edx"               \
  11.   "mov   ax, 0100h"         \
  12.   "int   31h"               \
  13.   "pop   ebx"               \
  14.   "mov   [ebx], dx"         \
  15.   "pop   ebx"               \
  16.   "mov   [ebx], ax"         \
  17.   parm   [bx] [ecx] [edx]   \
  18.   modify [ax ebx ecx edx];
  19.  
  20. /* ──────────────────────────────────────────────────────────────────────── */
  21.  
  22. void dos_memfree(short int sel);
  23. #pragma  aux dos_memfree =  \
  24.   "mov   ax, 0101h"         \
  25.   "int   31h"               \
  26.   parm   [dx]               \
  27.   modify [ax dx];
  28.  
  29. /* ════════════════════════════════════════════════════════════════════════ */
  30.  
  31. void *low_malloc(int size, short int *sel)
  32.   {
  33.     short int seg;
  34.  
  35.     dos_memalloc((size >> 4) + 1, &seg, sel);
  36.     return((char *)(seg << 4));
  37.   }
  38.  
  39. /* ──────────────────────────────────────────────────────────────────────── */
  40.  
  41. void low_free(short int sel)
  42.   {
  43.     dos_memfree(sel);
  44.   }
  45.  
  46. /* ████████████████████████████████████████████████████████████████████████ */
  47.